package com.bwie.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Title:
 * @BelongProjecet zk2
 * @BelongPackage com.bwie.config
 * @Description:
 * @Copyright 研发一部
 * @Author: Mr.yan
 * @Date: 2024/6/6 9:32
 * @Version V1.0
 */
@Configuration
public class RabbitMqConfig {
    /**
     * @Description: //TODO
     * @Auther: yanxingru
     * @Date: 2024/6/6 9:33
     * @param: 创建添加图片记录的队列
     * @return org.springframework.amqp.core.Queue
     */
    @Bean
    public Queue recordsQueue(){
        return new Queue("recordsQueue",true);
    }

    /**
     * @Description: //TODO
     * @Auther: yanxingru
     * @Date: 2024/6/6 11:06
     * @param: 创建交换机
     * @return org.springframework.amqp.core.DirectExchange
     */
    @Bean
    public DirectExchange directExchange(){
        return new DirectExchange("directExchange");
    }

    @Bean
    public Binding toRecordBind(){
        return BindingBuilder.bind(recordsQueue()).to(directExchange()).with("toRecordBind");
    }



}
